import { CellRenderer } from "../../../../../../fl/controls/listClasses/CellRenderer";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { BaseItem } from "../../../common/BaseItem";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ItemData } from "../../../../resource/info/ItemData";
import { RuneUtil } from "../RuneUtil";
//class RuneCellRenderer
    
    export  class RuneCellRenderer extends CellRenderer
    {
        constructor()
        {
            super();
            this.init();
            this.mouseChildren = true;
            return;
        }

        /* internal  */init(): void
        {
            this.initStyles();
            ObjCreate.createBg(0, 0, 147, 55, this, "DisabledBg");
            ObjCreate.createBitmap(ImagesConst.PackItemBg, 7, 7, this);
            this._baseItem = new BaseItem();
            ObjCreate.setObjAttri(this._baseItem, 10, 10, 32, 32, this);
            this._tfItemName = ObjCreate.createTextField("", 50, 9, 95, 20, this);
            this._tfItemLevel = ObjCreate.createTextField("", 53, 29, 95, 20, this);
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap(ImagesConst.SelectedBg));
            this.setStyle("overSkin", GlobalClass.getBitmap(ImagesConst.SelectedBg));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap(ImagesConst.SelectedBg));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap(ImagesConst.SelectedBg));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap(ImagesConst.SelectedBg));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "itemdata") 
            {
                this._itemData = arg1 as ItemData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._baseItem.itemData = this._itemData;
            this._tfItemName.text = this._itemData.name;
            this._tfItemLevel.htmlText = RuneUtil.getRuneItemLevelName(this._itemData);
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        /* internal */ /* var */_itemData: ItemData;

        /* internal */ /* var */_baseItem: BaseItem;

        /* internal */ /* var */_tfItemName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfItemLevel: Object /* flash.text.TextField */;
    }
